package basic_grammar

import "fmt"

func TestSlice() {

	testStringRange("你啊和哦发送fasdf")
}

func testValueOrReference() {
	a := [4]int{1, 2, 3, 4}
	b := []int{2, 4, 6, 8}
	changeArray(a)
	fmt.Println(a)
	c := b
	changeSlice(b)
	fmt.Println(c)
}

func changeArray(param [4]int) {
	param[0] = 100
}
func changeSlice(param []int) {
	param[0] = 100
}

func addElement() {
	var a []int
	fmt.Println(a)
	a = append(a, 1)
	a = append(a, 299)
	fmt.Println(a)
}

func testStringRange(str string) {
	//for i:=0 ;i<len(str);i++{
	//	fmt.Println(string(str[i]))
	//}
	//for _, v := range str {
	//	fmt.Println(string(v))
	//}
	runes := []rune(str)
	for i := 0; i < len(runes); i++ {
		fmt.Println(string(runes[i]))
	}
}
